﻿using WinRTSock.Test.Common;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Core;
using Windows.UI.Xaml;

namespace WinRTSock.Test
{
    public class StartPageViewModel : INotifyPropertyChanged
    {
        public ObservableCollection<ListItemViewModel> Items { get; private set; }
        public Action<string> ItemSelected { get; private set; }

        public StartPageViewModel(Action<string> itemSelected)
        {
            this.ItemSelected = itemSelected;
            this.Items = new ObservableCollection<ListItemViewModel>();
            this.Items.Add(ListItemViewModel.Create(null, "Run WinRTSock Tests", "View a list of tests to verify the expected functionality of the winsock functions which have been ported to WinRT for use with tinyNET", this.onItemCommand));
            //this.Items.Add(ListItemViewModel.Create(null, "Chat demo", "Run a simple demo that uses WinRTSock to do a simple text chat", this.onItemCommand));
        }

        private void onItemCommand(string arg)
        {
            this.ItemSelected.Invoke(arg);
        }



        public event PropertyChangedEventHandler PropertyChanged;
        protected void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
